<?php
/**
 * Created by PhpStorm.
 * User: lgy
 * Date: 2018/6/30
 * Time: 20:54
 */

namespace app\admin\controller;
use app\admin\model\Shop AS ShopModel;
use think\Request;
use think\View;

class Shop
{
	//展示店铺
	public function showShop(){
		$view = new View();
		return $view->fetch('shop/shop');
	}
	//展示店铺添加
	public function showShopAdd(){
		$view = new View();
		return $view->fetch('shop/shop_add');
	}
	//展示店铺详情
	public function showShopDetail(){
		$view = new View();
		return $view->fetch('shop/shop_detail');
	}
	//获取所有店铺
	public function getShop(){
		$result = ShopModel::getShop();
		return json($result);
	}
	//添加店铺
	public function addShop(){
		$request = Request::instance();
		$params = $request->param();
		$result = ShopModel::addShop($params);
		if($result){
			return adminRes('1','添加成功');
		}else{
			return adminRes('0','添加成功，请重试');
		}
	}
}